
const Constants = require('../../utils/constants');
const Api = require('../../utils/api.js');
const Rest = require('../../utils/rest');
const util = require('../../utils/util.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
     setting: {}
  },
  default: {
    background: Api.JIANGQIE_BG_FK,
    background1: Api.JIANGQIE_BG_FK,
    title: '请在后台＞蓝精灵插件＞反馈设置中配置！',
    description: '请在后台＞蓝精灵插件＞反馈设置中配置！',
},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    Rest.get(Api.JIANGQIE_SETTING_fk).then(res => {
        util.getshare(that);
        that.setData({
            setting: {
                background: res.data.background ? res.data.background : that.default.background,
                background1: res.data.background1 ? res.data.background1 : that.default.background1,
                title: res.data.title ? res.data.title : that.default.title,
                description: res.data.description ? res.data.description : that.default.description,
                description1: res.data.description1 ? res.data.description1 : that.default.description1,
            }
        });
    })
},
//tab -- end
handlerPageClick: function (e) {
  let page_id = e.currentTarget.dataset.page_id;
  wx.navigateTo({
      url: '/pages/viewhtml/viewhtml?page_id=' + page_id,
  })
},
handlerIconNavClick: function(e) {
  let link = e.currentTarget.dataset.link;
  this.openLink(link);
},
handlerActiveClick: function(e) {
  let link = e.currentTarget.dataset.link;
  this.openLink(link);
},
handlerArticleClick: function (e) {
  let post_id = e.currentTarget.dataset.id;
  wx.navigateTo({
      url: '/pages/article/article?post_id=' + post_id
  })
},
openLink: function(link) {
  if(link.startsWith('/pages')) {
      wx.navigateTo({
        url: link,
      })
  }
},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
/*结束*/ 

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  })